<template>
  <span>
{{leavevotes}}
  </span>
</template>
<script>
import {
  getServerHost,
  GetRequest,
  weChatRefresh
} from "@/assets/lib/tool.js";
export default {
  props: {
    vote: {
      type: Number
    }
  },
  data() {
    return {
      openid: GetRequest().openid,
      leavevotes: this.vote,
      getLeftVoteUrl: '/wxjx/goddess/common/vote/getLeftVotes', //判断剩余投票次数
    }
  },
  mounted() {
    // document.body.addEventListener('touchmove', preventMove, { passive: false })
    this.$nextTick(() => {
      //获取投票数
      this.getLeftVote();
    })
  },
  methods: {
    //剩余票数
    getLeftVote() {
      this.$http
        .get(getServerHost() + this.getLeftVoteUrl, {
          params: {
            openid: this.openid
          }
        }).then(result => {
          //console.log(result);
          result = result.data;
          if ('200' !== result.code) {
            return;
          }
          this.leavevotes = result.res.leftVots;
          //console.log('leavevote', this.leavevotes);

        })
    }
  },
}
</script>

<style lang="less" scoped>
span {
  position: absolute;
  right: 24px;
  bottom: 12px;
  font-size: 36px;
  font-weight: bold;
  color: #f5f296;
}
</style>

